{% extends 'base.html' %}

{% block content %}


    <h3 class="col-12 mt-4">reverse()</h3>
    <div class="col-12">
        <a class="btn btn-primary" href="{% url 'home' %}" role="button">Home</a>
        <a class="btn btn-warning"
           href="{% url 'demo:home_with_context' 0 %}"
           role="button"
        >
            Url
        </a>
        <a class="btn btn-danger" href="{% url 'demo:reverse' %}" role="button">Reverse</a>
        <a class="btn btn-success"
           href="{% url 'demo:reverse' 1 %}"
           role="button"
        >
            Reverse with params
        </a>
        <span class="alert alert-light" role="alert">{{ content }}</span>
    </div>

    <h3 class="col-12 mt-4">redirect()</h3>
    <div class="col-6">
        {% for post in posts %}
            <div class="alert alert-warning">
                <a class="col-12 alert-link" href="{% url 'demo:redirect' post.id %}">{{ post.title }}</a>
            </div>
        {% endfor %}
    </div>

    <h3 class="col-12 mt-4">path()</h3>

    <div class="col-6">
        <div class="alert alert-primary">
            <a class="col-12 alert-link" href="{% url 'demo:path' 99 'welcome' %}?first_name=Du&last_name=Sai">通过 path()
                传递参数</a>
        </div>
    </div>

    <h3 class="col-12 mt-4">@property 与模型方法</h3>

    <div class="col-6">
        <div class="alert alert-info">Full name: {{ name1 }}</div>
        <div class="alert alert-info">Full name: {{ name2 }}</div>
    </div>

    <h3 class="col-12 mt-4">批量上传文件</h3>
    <div class="col-6">
        <form action="{% url 'demo:uploads' %}"
              method="post"
              enctype="multipart/form-data"
        >{% csrf_token %}
            <div class="form-group">
                <input type="file"
                       id="upload"
                       name="file_field"
                       required
                       placeholder="请输入标题"
                       autocomplete="off"
                       class="form-control-file"
                       multiple="multiple"
                >
            </div>
            <div class="form-group">
                <input type="submit" value="提交" class="btn btn-primary">
            </div>
        </form>
    </div>

    <h3 class="col-12 mt-4">Session</h3>
    <div class="col-12">
        <a class="btn btn-primary" href="{% url 'demo:visits_count' %}" role="button">Session记录</a>

    </div>

    <br>
    <br>
    <br>
    <br>
{% endblock %}